/**
 * 用户选择窗口
 */
Ext.define('Jason.view.protal.module.systemManager.right.users.selectUser.Win',{
	extend : 'Ext.container.Container',
	xtype : 'selectUserView',
	requires:[
		'Jason.store.protal.module.systemManager.right.organize.TreeStore',
		'Jason.store.protal.module.systemManager.right.users.UserSearchByRoleStore',
		'Jason.view.protal.module.systemManager.right.users.ViewModel',
	],
	viewModel: { type: 'users_MainViewModel' },
	layout: {
        type: 'hbox',
        align: 'stretch'
    },
	items:[{
    	cls: 'faq-left-sidebar shadow-panel',
        ui: 'light',
        border: true,
        xtype: 'treepanel',
        title: '数据结构',
        ui: 'light',
        reserveScrollbar: true,
        useArrows: true,
        rootVisible: false,
        multiSelect: true,
        singleExpand: true,
        bind: '{leftMenuTreeStore}',
        listeners: {
            itemclick: 'onTreeNodeClick'
        },
        dockedItems: [{
            xtype: 'toolbar-noinputpaging',
            bind: '{leftMenuTreeStore}',
            dock: 'bottom'
        }],
        listeners:{
        	itemclick:function(panel,record){
        		var userView = panel.up('selectUserView').down('baseView');
        		userView.load({
        			orgCode: record.get('id')
        		});
        	}
        },
        iconCls: 'x-fa fa-sitemap',
        width:250
    },{
    	xtype : 'baseView',flex:1,margin: '0 0 0 6',enabledMark: false,
    	dockedItems: [{
    		xtype: 'pagingtoolbar',
            bind: '{userSearchByRoleStore}',
            dock: 'bottom'
        },{
        	xtype : 'toolbar',
        	dock : 'top',
        	items:[{
        		xtype : 'textfield',fieldLabel:'姓名',labelAlign:'right',labelWidth:40,name:'userName'
        	},{
        		xtype : 'button',iconCls : 'fa fa-search',text:'查询',ui:'btn-default-round',
        		listeners:{
        			click:function(btn){
        				var userView = btn.up('selectUserView').down('baseView');
        				var input = userView.down('textfield[name=userName]');
        				userView.load({
        					userName: input.getValue()
        				});
        			}
        		}
        	}]
        }],
        bind: '{userSearchByRoleStore}',
        selType: 'checkboxmodel',
        multiSelect: true,
        columns: [
            { xtype: 'rownumberer', text: '序号', align: 'center', width: 50 },
            {
                text: '姓名', dataIndex: 'realname', minWidth: 100, flex: 2, renderer: function (v, mate) {
                    mate.style = "font-weight:bold;";
                    return v;
                }
            },
            { text: '帐号', dataIndex: 'loginname', minWidth: 100, flex: .2 },
            { text: '性别', dataIndex: 'sexText', width: 47, menuDisabled: true},
            { text: '民族', dataIndex: 'nationText', width: 92, menuDisabled: true},
            { text: '联系电话', dataIndex: 'mobphone', minWidth: 110, flex: .35, menuDisabled: true },
            { text: '创建日期', dataIndex: 'createDate', width: 135, xtype: 'datecolumn', format: 'Y-m-d H:i' }
        ]
    }]
});